package 结构器模式.享元模式;

/**
 * @Description TODO
 * @Author shallow
 * @Date 2023/3/6 14:34
 */

public class Client {
    public static void main(String[] args) {
        AbstractBox box1=BoxFactory.getInstance().getShape("I");
        box1.display("绿色");

        AbstractBox box2=BoxFactory.getInstance().getShape("L");
        box2.display("红色");

        AbstractBox box3=BoxFactory.getInstance().getShape("O");
        box3.display("紫色");

        //看两次获得的同一种方块是不是同一个对象
        AbstractBox box4=BoxFactory.getInstance().getShape("I");
        System.out.println(box1 == box4);


    }
}
